#include "Time.h"

#include <string.h>
#include <fan-llvm/core/Core.h>
#include "Type.h"
#include "UnsupportedErr.h"


Type* Time_classType = NULL;
VTable* Time_classVTable = NULL;


/**********************************************
 *
 * Methods and fields
 *
 **********************************************/


/* Bool equals(Obj? that) */
Bool Time_equals(Obj self, NullableObj that)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.equals not implemented yet"));
}


/* Int compare(Obj obj) */
Int Time_compare(Obj self, Obj obj)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.compare not implemented yet"));
}


/* Int hash() */
Int Time_hash(Obj self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.hash not implemented yet"));
}


/* Str toStr() */
Str* Time_toStr(Obj self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.toStr not implemented yet"));
}


/* Time defVal */
Time* Time_defVal(void)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.defVal not implemented yet"));
}


/* Time now(TimeZone tz) */
Time* Time_now_0(void)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.now not implemented yet"));
}


/* Time now(TimeZone tz) */
Time* Time_now(TimeZone* tz)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.now not implemented yet"));
}


/* Time make(Int hour, Int min, Int sec, Int ns) */
Time* Time_make_2(Int hour, Int min)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.make not implemented yet"));
}


/* Time make(Int hour, Int min, Int sec, Int ns) */
Time* Time_make_3(Int hour, Int min, Int sec)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.make not implemented yet"));
}


/* Time make(Int hour, Int min, Int sec, Int ns) */
Time* Time_make(Int hour, Int min, Int sec, Int ns)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.make not implemented yet"));
}


/* Time? fromStr(Str s, Bool checked) */
Time* Time_fromStr_1(Str* s)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.fromStr not implemented yet"));
}


/* Time? fromStr(Str s, Bool checked) */
Time* Time_fromStr(Str* s, Bool checked)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.fromStr not implemented yet"));
}


/* Int hour() */
Int Time_hour(Time* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.hour not implemented yet"));
}


/* Int min() */
Int Time_min(Time* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.min not implemented yet"));
}


/* Int sec() */
Int Time_sec(Time* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.sec not implemented yet"));
}


/* Int nanoSec() */
Int Time_nanoSec(Time* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.nanoSec not implemented yet"));
}


/* Str toLocale(Str? pattern) */
Str* Time_toLocale_0(Time* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.toLocale not implemented yet"));
}


/* Str toLocale(Str? pattern) */
Str* Time_toLocale(Time* self, Str* pattern)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.toLocale not implemented yet"));
}


/* Time? fromLocale(Str str, Str pattern, Bool checked) */
Time* Time_fromLocale_2(Str* str, Str* pattern)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.fromLocale not implemented yet"));
}


/* Time? fromLocale(Str str, Str pattern, Bool checked) */
Time* Time_fromLocale(Str* str, Str* pattern, Bool checked)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.fromLocale not implemented yet"));
}


/* Time? fromIso(Str s, Bool checked) */
Time* Time_fromIso_1(Str* s)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.fromIso not implemented yet"));
}


/* Time? fromIso(Str s, Bool checked) */
Time* Time_fromIso(Str* s, Bool checked)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.fromIso not implemented yet"));
}


/* Str toIso() */
Str* Time_toIso(Time* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.toIso not implemented yet"));
}


/* Time fromDuration(Duration d) */
Time* Time_fromDuration(Duration* d)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.fromDuration not implemented yet"));
}


/* Duration toDuration() */
Duration* Time_toDuration(Time* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.toDuration not implemented yet"));
}


/* DateTime toDateTime(Date d, TimeZone tz) */
DateTime* Time_toDateTime_1(Time* self, Date* d)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.toDateTime not implemented yet"));
}


/* DateTime toDateTime(Date d, TimeZone tz) */
DateTime* Time_toDateTime(Time* self, Date* d, TimeZone* tz)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.toDateTime not implemented yet"));
}


/* Str toCode() */
Str* Time_toCode(Time* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.toCode not implemented yet"));
}


/* Bool isMidnight() */
Bool Time_isMidnight(Time* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Time.isMidnight not implemented yet"));
}


/**********************************************
 *
 * Type-system functions
 *
 **********************************************/


Type* Time_initType(void)
{
  if (Time_classType == NULL)
  {
    Type* baseType = Obj_initType();
    VTable* vtable = Time_initVTable();
    Type* type = Type_new("Time", baseType, vtable, sizeof(Time), sizeof(TimeVTable));
    Type_registerMethodImplementation(type, "compare", Time_compare, 1);
    Type_registerMethodImplementation(type, "equals", Time_equals, 1);
    Type_registerMethodImplementation(type, "fromDuration", Time_fromDuration, 1);
    Type_registerMethodImplementation(type, "fromIso", Time_fromIso_1, 1);
    Type_registerMethodImplementation(type, "fromIso", Time_fromIso, 2);
    Type_registerMethodImplementation(type, "fromLocale", Time_fromLocale_2, 2);
    Type_registerMethodImplementation(type, "fromLocale", Time_fromLocale, 3);
    Type_registerMethodImplementation(type, "fromStr", Time_fromStr_1, 1);
    Type_registerMethodImplementation(type, "fromStr", Time_fromStr, 2);
    Type_registerMethodImplementation(type, "hash", Time_hash, 0);
    Type_registerMethodImplementation(type, "hour", Time_hour, 0);
    Type_registerMethodImplementation(type, "isMidnight", Time_isMidnight, 0);
    Type_registerMethodImplementation(type, "make", Time_make_2, 2);
    Type_registerMethodImplementation(type, "make", Time_make_3, 3);
    Type_registerMethodImplementation(type, "make", Time_make, 4);
    Type_registerMethodImplementation(type, "min", Time_min, 0);
    Type_registerMethodImplementation(type, "nanoSec", Time_nanoSec, 0);
    Type_registerMethodImplementation(type, "now", Time_now_0, 0);
    Type_registerMethodImplementation(type, "now", Time_now, 1);
    Type_registerMethodImplementation(type, "sec", Time_sec, 0);
    Type_registerMethodImplementation(type, "toCode", Time_toCode, 0);
    Type_registerMethodImplementation(type, "toDateTime", Time_toDateTime_1, 1);
    Type_registerMethodImplementation(type, "toDateTime", Time_toDateTime, 2);
    Type_registerMethodImplementation(type, "toDuration", Time_toDuration, 0);
    Type_registerMethodImplementation(type, "toIso", Time_toIso, 0);
    Type_registerMethodImplementation(type, "toLocale", Time_toLocale_0, 0);
    Type_registerMethodImplementation(type, "toLocale", Time_toLocale, 1);
    Type_registerMethodImplementation(type, "toStr", Time_toStr, 0);
    Type_registerFieldImplementation(type, "defVal", Time_defVal, NULL);
    Time_classType = type;
    Time_initStatic();
  }
  return Time_classType;
}


VTable* Time_initVTable(void)
{
  if (Time_classVTable == NULL)
  {
    VTable* vtable = memoryAlloc(sizeof(TimeVTable));
    memcpy(vtable, Obj_initVTable(), sizeof(FanObjVTable));
    ((FanObjVTable*)vtable)->compare = Time_compare;
    ((FanObjVTable*)vtable)->equals = Time_equals;
    ((FanObjVTable*)vtable)->hash = Time_hash;
    ((FanObjVTable*)vtable)->toStr = Time_toStr;
    Time_classVTable = vtable;
  }
  return Time_classVTable;
}


void Time_initStatic(void)
{
}
